package com.king.common

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment

/**
 * @Author: KingWang
 * @Date: 2022/1/25  
 * @Desc:
 **/
object FlinkConfig {

  def setWebPort(env:StreamExecutionEnvironment,port:String) = {
    val javaEnv = env.getJavaEnv
    val field = classOf[org.apache.flink.streaming.api.environment.StreamExecutionEnvironment].getDeclaredField("configuration")
    field.setAccessible(true)
    import org.apache.flink.configuration.Configuration
    val configuration: Configuration = field.get(javaEnv).asInstanceOf[Configuration]
    configuration.setString("rest.bind-port", port)
  }

}
